// 찜리스트에서 회원의 상세 정보를 보는 자바스크립트
$(document).ready(function(){
	
	$("#selectedList_main_table_type_t").hide();
	$("input[name=listtype]").change(function(){
		$("#selectedList_main_table_type_s").toggle();
		$("#selectedList_main_table_type_t").toggle();
		
		var dataString = "id="+$("input[name=id]").val()
							+"&membertype="+$("input[name=membertype]").val()
							+"&listtype="+$(this).val();
		
		$.ajax({
			type:"post",
			url:"switchSelectedList.do",
			dataType:"json",
			data:dataString,
			success:function(jsonData){
				$("#selectedList_main_table_type_t tbody").children().remove(); 
				var tagString="";
				$.each(jsonData.t,function(index,list){
					tagString+="<tr><td>"+list.studentVO.name
					+"</td><td>"+list.studentVO.gender
					+"</td><td>"+list.studentVO.grade
					+"</td><td>"+list.studentVO.hopesubject
					+"</td></tr>";	
				}); 
				$("#selectedList_main_table_type_t tbody").append(tagString); 
			}
		});
	});
	$("#selectedList_main_table_type_s>tbody").click(function(){
		alert($(this).text());
	});
});